package com.cn.medicalcare.controller.backstageservlet.imgservlet;

import com.cn.medicalcare.service.UpLoadImgService;
import com.cn.medicalcare.service.serviceimpl.UpLoadImgServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;

@WebServlet("/backstage/deleteimg.json")
public class DeleteImgServlet extends HttpServlet {

    private UpLoadImgService upLoadImgService = UpLoadImgServiceImpl.getInstance();

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String img = req.getParameter("img");
        upLoadImgService.deleteImgByPath(img);
    }
}
